From e82c68accd810e808bb0fb08ffb88599156bbc2e Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 13 Aug 2018 20:05:50 -0300 Subject: [PATCH] switcherPopup: Rename destroy() to fadeAndDestroy() In the process of purging all usages of Shell.GenericContainer of GNOME Shell, one specific problematic situation that might occur is when classes have functions that would clash with any ClutterActor or StWidget function name. One of such example is SwitcherPopup.destroy(). Right now, this class is a pure JavaScript class that wraps a real actor, but soon this will change, and it'll become a St.Widget subclass. Another problem with functions that mimic the toolkit ones is the predictability of them; after calling destroy(), that widget is expected to not be available anymore. In SwitcherPopup case, it is still available for a short while. In this case, that's not a big problem, but the show() and hide() functions in other clases are more problematic because the actor's visibility does not follow that. This commit is a first step in cleaning that up, and changes the SwitcherPopup.destroy() to fadeAndDestroy(). https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153 --- js/ui/altTab.js | 2 +- js/ui/status/keyboard.js | 2 +- js/ui/switcherPopup.js | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/ui/altTab.js b/js/ui/altTab.js index d0c3713cf..885727158 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -262,7 +262,7 @@ var AppSwitcherPopup = new Lang.Class({ _windowActivated(thumbnailList, n) { let appIcon = this._items[this._selectedIndex]; Main.activateWindow(appIcon.cachedWindows[n]); - this.destroy(); + this.fadeAndDestroy(); }, _windowEntered(thumbnailList, n) { diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index a17e9c43b..b0cc9bb00 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -414,7 +414,7 @@ var InputSourceManager = new Lang.Class({ let popup = new InputSourcePopup(this._mruSources, this._keybindingAction, this._keybindingActionBackward); if (!popup.show(binding.is_reversed(), binding.get_name(), binding.get_mask())) - popup.destroy(); + popup.fadeAndDestroy(); }, _keyboardOptionsChanged() { diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index d645f1df9..9c392f9be 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -195,7 +195,7 @@ var SwitcherPopup = new Lang.Class({ // Note: pressing one of the below keys will destroy the popup only if // that key is not used by the active popup's keyboard shortcut if (keysym == Clutter.Escape || keysym == Clutter.Tab) - this.destroy(); + this.fadeAndDestroy(); return Clutter.EVENT_STOP; }, @@ -215,7 +215,7 @@ var SwitcherPopup = new Lang.Class({ }, _clickedOutside(actor, event) { - this.destroy(); + this.fadeAndDestroy(); return Clutter.EVENT_PROPAGATE; }, @@ -255,7 +255,7 @@ var SwitcherPopup = new Lang.Class({ let newIndex = Math.min(n, this._items.length - 1); this._select(newIndex); } else { - this.actor.destroy(); + this.fadeAndDestroy(); } }, @@ -298,7 +298,7 @@ var SwitcherPopup = new Lang.Class({ } }, - destroy() { + fadeAndDestroy() { this._popModal(); if (this.actor.visible) { Tweener.addTween(this.actor, @@ -314,7 +314,7 @@ var SwitcherPopup = new Lang.Class({ }, _finish(timestamp) { - this.destroy(); + this.fadeAndDestroy(); }, _onDestroy() { -- 2.39.5